package featureMode;

import org.checkerframework.checker.units.qual.A;

import java.io.UnsupportedEncodingException;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * Created by admin on 2020/4/17.
 */
public class featureMode1 {

    public static void main(String[] args) throws InterruptedException, ExecutionException, UnsupportedEncodingException {
        /*long startTime = System.currentTimeMillis();
        // 第一步 网购厨具
        Callable<Chuju> onlineShopping = new Callable<Chuju>() {

            @Override
            public Chuju call() throws Exception {
                System.out.println("第一步：下单");
                System.out.println("第一步：等待送货");
                Thread.sleep(5000);  // 模拟送货时间
                System.out.println("第一步：快递送到");
                return new Chuju();
            }

        };
        FutureTask<Chuju> task = new FutureTask<Chuju>(onlineShopping);
        new Thread(task).start();
        // 第二步 去超市购买食材
        Thread.sleep(2000);  // 模拟购买食材时间
        Shicai shicai = new Shicai();
        System.out.println("第二步：食材到位");
        // 第三步 用厨具烹饪食材
        if (!task.isDone()) {  // 联系快递员，询问是否到货
            System.out.println("第三步：厨具还没到，心情好就等着（心情不好就调用cancel方法取消订单）");
        }
        Chuju chuju = task.get();
        System.out.println("第三步：厨具到位，开始展现厨艺");
        cook(chuju, shicai);

        System.out.println("总共用时" + (System.currentTimeMillis() - startTime) + "ms");*/

       /* Calendar c = Calendar.getInstance();
        c.setTime(new Date());
        //c.add(Calendar.DAY_OF_WEEK, 1);// 不包括今天
        System.out.println(c.get(Calendar.YEAR));
        System.out.println(c.get(Calendar.MONTH));
        System.out.println(c.get(Calendar.DATE));*/
        /*List<Integer> l = new ArrayList<>();
        l.add(1);
        l.add(2);
        l.add(3);
        l.add(4);
        Map map = new HashMap<>();
        map.put("map", l);
        List<Integer> list = (List<Integer>) map.get("map");
        list=list.subList(0,1);
        map.put("map", list);*/
        /*List<Integer> l1=new ArrayList<>();
        l1.add(1);
        l1.add(2);
        l1.add(3);
        List<Integer> l2=new ArrayList<>();
        //l2.add(2);
        l2.add(2);
        l2.retainAll(l1);
        System.out.println(l2);*/
        /*int i=1;
        int i1=2;
        Shicai s=new Shicai();
        s.setI(i);
        int j=s.getI();
        s.setI(i1);*/
        //String s="2020-05-19 08:15:00";
        /*Shicai a=null;
        System.out.println("".equals(a.getI()));*/
        //System.out.println(31^ 20);
        //System.out.println(Add(21, 10));
        /**
         * 0001 1001
         * 1000 0010
         * 1010 0000
         *
         * 10101   10101
         * 000000  101010
         * 101010  000000
         * 101010
         */
        String url = String.format("%d=%s&", 1, "b");;
        System.out.println(url);
    }


    public static int Add(int a, int b) {
        return b == 0 ? a : Add(a ^ b, (a & b) << 1);
    }

    //  用厨具烹饪食材
    static void cook(Integer i) {
        i = 4;
    }

    // 厨具类
    static class Chuju {
    }

    // 食材类
    static class Shicai {
        int i;

        public int getI() {
            return i;
        }

        public void setI(int i) {
            this.i = i;
        }
    }

}
